#ifndef QSSLSERVER_H
#define QSSLSERVER_H

#include <QObject>
#include <QTcpServer>
#include <QSslSocket>
#include <QMap>
#include <QFile>
#include <QDebug>
#include <QSslCertificate>
#include <QSslKey>
#include <QSslConfiguration>


//处理证书加密套件
class QSslServer : public QTcpServer {
    Q_OBJECT

public:
    explicit QSslServer(QObject *parent = nullptr);

protected:
    //重写父类方法，如果有socket连接过来，则创建socket对象，并设置加密配置
    void incomingConnection(qintptr socketDescriptor) override;

private:
    QSslKey m_key; // 私钥
    QSslCertificate m_certificate; // 证书

    QMap<QString, QString> clientCertMap;

signals:
    void newSslConnection(QSslSocket *sslSocket);
};


#endif

